<template>
    <div>
        <button>{{num}}</button>
    </div>
</template>

<script>
// eslint-disable-next-line no-unused-vars
var timer =null;
    export default {
        data(){
            return{
                num:3
            }
        },
        createBefore(){
            var num = this.num;
            num--;
            console.log(num)
            this.countreduce()
        },
        methods:{
            countreduce(){
                var num = this.num;
                setTimeout(() => {
                    num--;
                    console.log(num)
                    if(num>=0){
                        if(num==0){
                            this.$router.push('/music')
                        }
                        this.countreduce()
                    }
                }, 1000);
            }
        }
    }
</script>

<style scoped>

</style>